Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] [10.0] [BR001136] [23300] account_invoice_kanban #309

Merged
merged 1 commit into from
Sep 19, 2017

Conversation

nikul-serpentcs
Copy link
Member

Migrated 'account_invoice_kanban' module for kanban view of invoices like customer invoice and supplier invoice.

@nikul-serpentcs
Copy link
Member Author

@elicoidal Could you please review code.

@nikul-serpentcs nikul-serpentcs force-pushed the 10.0-account_invoice_kanban branch from c40bbf8 to 972f9ed Compare August 30, 2017 12:41
Copy link

@elicoidal elicoidal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Couldnot test it in Runbot though

=======================
Account Invoice Kanban
=======================

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty lines

Copy link

@lasley lasley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nikul-serpentcs

IMO this should use base_kanban_stage, which would reduce the need for boilerplate code.

I won't block for that, but I do feel that the lack of automated testing is a problem 👎

Edit: link

<field name="sequence">4</field>
<field name="name">Documentation Sent</field>
</record>
<record id="invoice_recrived" model="account.invoice.stage">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

received

@lasley
Copy link

lasley commented Aug 31, 2017

Ok wait maybe I'm confused here - I assumed that we would have the standard Kanban logic, such as the default stage and _read_group_stage_ids, which would require automated testing. Is that not necessary here for some reason, or am I overlooking something?

Also - why are we introducing entirely new invoice tree views?

@elicoidal
Copy link

IMO this should use base_kanban_stage, which would reduce the need for boilerplate code.

I dont know the module and not against using it

@elicoidal
Copy link

Also - why are we introducing entirely new invoice tree views?

Indeed: there is no functional reason for it at least

@nikul-serpentcs
Copy link
Member Author

nikul-serpentcs commented Aug 31, 2017

Hello, @lasley
Can you please let me know, how could I adapt the base_kanban_stage in our module?!

@nikul-serpentcs
Copy link
Member Author

Ok wait maybe I'm confused here - I assumed that we would have the standard Kanban logic, such as the default stage and _read_group_stage_ids, which would require automated testing. Is that not necessary here for some reason, or am I overlooking something?

@lasley Okay then we'll use the base_kanban_stage, so I guess then it will be fine, right?

And also we need some help to use it!

@lasley
Copy link

lasley commented Aug 31, 2017

Okay then we'll use the base_kanban_stage, so I guess then it will be fine, right?
And also we need some help to use it!

It's so simple! There's some usage instructions here. Here's an example of a model that has stages, and here's the view.

@nikul-serpentcs
Copy link
Member Author

@elicoidal @lasley
Adapted the base_kanban_stage module, Could you please review code.

@elicoidal
Copy link

@nikul-serpentcs After tested here is my feedback:

  • there is no menu anymore to create the invoicing stages
  • there is no upper right bar to be able to click and change the stages anymore in form view
  • demo stage are not preloaded anymore

Can you review it?

@nikul-serpentcs
Copy link
Member Author

there is no menu anymore to create the invoicing stages

@elicoidal stages are managed, go to Settings > Technical > Kanban > Stages.

Copy link

@lasley lasley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nikul-serpentcs - comments inline

=======================


Introduction
Copy link

@lasley lasley Sep 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this header please - introduction is assumed to be the text immediately below the main header

=============
Stage are set up in the Invoicing application:

#. Invoicing menu --> Configuration --> Stages --> Invoice Stages
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update for new location


Known Issues / Roadmap
======================
* Stages are somehow redondant with invoice status: it would be good to have the option to
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_order = 'date_due asc'

@api.multi
def _read_group_stage_ids(self, stages, domain, order):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is implemented in the base & doesn't look to be changed here. I think you can delete

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikul-serpentcs I agree with @lasley.

You inherit base.kanban.abstract and here the original code:

    @api.multi
    def _read_group_stage_ids(self, stages, domain, order):
        search_domain = [('res_model_id.model', '=', self._name)]
        if domain:
            search_domain.extend(domain)
        return stages.search(search_domain, order=order)

Then here:

    @api.multi
    def _read_group_stage_ids(self, stages, domain, order):
        search_domain = [('res_model_id.model', '=', self._name)]
        return stages.search(search_domain, order=order)

So the only real change is you remove the if condition, may I ask why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victormartinelicocorp Yes the code was changed a long time ago, you are referring to the old code.

Please check the latest changes where the @lasley comment is attended, thanks!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darshan-serpent Could you help me with the review and give the link to the comment on @lasley you mention?

About the code
I am looking at this: https://github.com/OCA/account-invoicing/pull/309/files#diff-f0c2828b9fe5cf1e5f1cd28f2a52f4c2
And this: https://github.com/OCA/server-tools/blob/10.0/base_kanban_stage/models/base_kanban_abstract.py#L109

I am not necessary subscribing all opinions of others reviewers so please attend my concern that is:

  • Here you are overwriting a function that seems not been changed just for an if condition that perhaps is necessary.
    I am not asking for change the code if you give a reason.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed now due to OCA/server-tools#989

@nikul-serpentcs nikul-serpentcs force-pushed the 10.0-account_invoice_kanban branch 2 times, most recently from b1bd79a to daeabed Compare September 2, 2017 06:08
@nikul-serpentcs
Copy link
Member Author

@lasley I removed the domain parameter from the method as it was catching the domain from the invoice action, which eventually showed me the below error:

raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))
ValueError: Invalid field u'type' in leaf "<osv.ExtendedLeaf: (u'type', u'in', [u'out_invoice', u'out_refund']) on base_kanban_stage (ctx: )>"

@lasley
Copy link

lasley commented Sep 4, 2017

@nikul-serpentcs are you referring to _read_group_stage_ids? If so, it would be better to instead remove the domain and call the super with a blank domain instead of reimplementing. Otherwise you're cutting off the inheritance chain, which could have unknown effects when other modules start interacting with your's.

Also please add automated tests for all logic. In the instance of your _read_group_stage_ids fix, for example, you should validate that you can send through the parameters that were causing the error you mentioned and that you receive the appropriate return.

@elicoidal
Copy link

Another little fix to add: when copying an invoice, the stage should be reset to draft (first in the sequence)

@elicoidal
Copy link

@nikul-serpentcs

@nikul-serpentcs
Copy link
Member Author

@lasley @elicoidal
Added unit test case and fixed stage and _read_group_stage_ids method.
Could you please review code.

@elicoidal
Copy link

@nikul-serpentcs did you fix #309 (comment)?

@elicoidal
Copy link

and #309 (comment)?

@nikul-serpentcs
Copy link
Member Author

@elicoidal Added Demo data file.
Please check it.

@elicoidal
Copy link

elicoidal commented Sep 5, 2017

  • Make sure the kanban stages are not folded (except payment received)
  • I cannot find the menu to set up the stages

@lasley
Copy link

lasley commented Sep 5, 2017

I cannot find the menu to set up the stages

Hmmm so this is in the base module, and it's probably because you don't have debug mode active (it's in the Tech Settings).

For the most part we've found that the KanBan menus are configured by implementers using the main menu, but the users all seem to be managing directly in the KanBan view. Do you disagree with this evaluation?

@nikul-serpentcs
Copy link
Member Author

Make sure the kanban stages are not folded (except payment received)

@elicoidal Only payment received stage are folded other stages are not folded.
Please check it.

@nikul-serpentcs
Copy link
Member Author

#175

@elicoidal
Copy link

I have a traceback in current runbot. Just activated the dev mode and then:
TypeError: dict.record.kanban_user_id is undefined
http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js line 2950 > Function:74
Traceback:
anonymous@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js line 2950 > Function:74:54
_render@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:2949:262
render@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:2949:146
_render@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:2953:52
render@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:2949:146
init_content@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/541-73a394e/web.assets_backend.js:3917:45
init@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/541-73a394e/web.assets_backend.js:3916:1003
OdooClass.extend/</prototype[name]</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3010:556
Class@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3011:55
add_record@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/541-73a394e/web.assets_backend.js:3947:256
start@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/541-73a394e/web.assets_backend.js:3944:219
__widgetRenderAndInsert/<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3113:958
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:678
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
add@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:542:467
then/</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:631
each@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:370:758
then/<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:553
Deferred@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:548:189
then@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:518
__widgetRenderAndInsert@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3113:879
appendTo@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3113:92
render_grouped/<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/541-73a394e/web.assets_backend.js:3972:228
_.forEach@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:12:558
render_grouped@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/541-73a394e/web.assets_backend.js:3972:118
render@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/541-73a394e/web.assets_backend.js:3967:320
proxy/<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3127:8
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:678
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:849
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
Deferred/</deferred[tuple[0]]@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:548:31
add/<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3219:259
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
Deferred/</deferred[tuple[0]]@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:548:31
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
Deferred/</deferred[tuple[0]]@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:548:31
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:849
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
updateFunc/<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:549:482
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:849
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
Deferred/</deferred[tuple[0]]@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:548:31
add/<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:3219:259
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:849
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
Deferred/</deferred[tuple[0]]@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:548:31
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:849
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
then/</</<@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:547:849
fire@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:541:281
fireWith@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:546:198
done@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:937:86
callback@http://3302620-309-af824f.runbot1.odoo-community.org/web/content/535-c3615f4/web.assets_common.js:957:15

@nikul-serpentcs nikul-serpentcs force-pushed the 10.0-account_invoice_kanban branch from 69b9efe to 88708e8 Compare September 6, 2017 12:03
@nikul-serpentcs
Copy link
Member Author

nikul-serpentcs commented Sep 6, 2017

@elicoidal @lasley
Field name changed in server-tools module here.

@tafaRU
Copy link
Member

tafaRU commented Sep 6, 2017

FYI, base_kanban_stage to work properly needs OCA/server-tools#967 as consequence of a bug introduced by OCA/server-tools#949

Otherwise the following js error is raised:

Uncaught Error: QWeb2 - template['kanban-box']: Runtime Error: TypeError: Cannot read property 'raw_value' of undefined

So please review it and merge it asap. Thanks!

@lasley
Copy link

lasley commented Sep 6, 2017

OCA/server-tools#949 merged. @nikul-serpentcs can you amend your last commit and force push to trigger a build on the new base, please and thanks 😄

@nikul-serpentcs nikul-serpentcs force-pushed the 10.0-account_invoice_kanban branch from a76be1f to 0c5c050 Compare September 7, 2017 04:54
@nikul-serpentcs
Copy link
Member Author

@elicoidal @lasley Amended changes, can you please review it

Thanks 😄

@elicoidal
Copy link

@tafaRU @lasley thanks a lot!
@nikul-serpentcs I finally found the stages setup in settings/technical/Kanban/Stages (with dev mode). I will add a note in the README in the configuration section.

After that, I think we are good to go

Copy link

@elicoidal elicoidal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional tests are OK.
@lasley ?
@victormartinelicocorp?

_order = 'date_due asc'

@api.multi
def _read_group_stage_ids(self, stages, domain, order):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikul-serpentcs I agree with @lasley.

You inherit base.kanban.abstract and here the original code:

    @api.multi
    def _read_group_stage_ids(self, stages, domain, order):
        search_domain = [('res_model_id.model', '=', self._name)]
        if domain:
            search_domain.extend(domain)
        return stages.search(search_domain, order=order)

Then here:

    @api.multi
    def _read_group_stage_ids(self, stages, domain, order):
        search_domain = [('res_model_id.model', '=', self._name)]
        return stages.search(search_domain, order=order)

So the only real change is you remove the if condition, may I ask why?

@nikul-serpentcs
Copy link
Member Author

nikul-serpentcs commented Sep 7, 2017

@victormartinelicocorp Code has been changed
Please check here.

@serpentcs-dev1
Copy link
Member

@victormartinelicocorp Yes, we overwrote the function and removed the if condition.

As if we don't pass the domain blank, it was showing error. The domain included was (u'type', u'in', [u'out_invoice', u'out_refund']) which was not needed, so we passed it blank.

As the base _read_group_stage_ids method allows you to extend the domain, in which our case it was needed.

Please refer domain error and lasley comment

@lasley
Copy link

lasley commented Sep 11, 2017

@darshan-serpent - That makes sense, but why can we not just call the super with a blank domain then?

Copy link

@lasley lasley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore my last comment - seems I missed a commit!

@lasley
Copy link

lasley commented Sep 11, 2017

@elicoidal - do you mind if we squash your ReadMe updates into @nikul-serpentcs commits to save some changelog?

If not, can you please squash at your leisure for merge?

_order = 'date_due asc'

@api.multi
def _read_group_stage_ids(self, stages, domain, order):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I added this to a collapsed thread:

This can be removed now due to OCA/server-tools#989

@nikul-serpentcs
Copy link
Member Author

@lasley @elicoidal Removed read_group method, Could you please look it.

@elicoidal
Copy link

do you mind if we squash your ReadMe updates into @nikul-serpentcs commits to save some changelog?

no problem

@nikul-serpentcs nikul-serpentcs force-pushed the 10.0-account_invoice_kanban branch from 90b2eb7 to 47fe0a5 Compare September 19, 2017 08:56
@nikul-serpentcs
Copy link
Member Author

@elicoidal Done squashed all commits.

@elicoidal
Copy link

Functional tests OK: for me good to go!

@elicoidal elicoidal merged commit 7d23411 into OCA:10.0 Sep 19, 2017
@nikul-serpentcs nikul-serpentcs deleted the 10.0-account_invoice_kanban branch September 19, 2017 09:02
jbaudoux pushed a commit to QANSEE/account-invoicing that referenced this pull request Apr 18, 2018
dsolanki-initos pushed a commit to initOS/account-invoicing that referenced this pull request Nov 5, 2019
dsolanki-initos pushed a commit to initOS/account-invoicing that referenced this pull request Dec 15, 2020
dsolanki-initos pushed a commit to initOS/account-invoicing that referenced this pull request Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants